#include <stdio.h>
#define MAX 10
#define ElementType int

typedef struct Queue
{
    ElementType queue[MAX];
    int len;
    int front;
    int rear;
    ElementType FrontData;
}Queue;
void InitQueue(Queue *qp)
{
    qp->front=0;
    qp->rear=0;
    qp->len=0;
}
void Push(Queue *qp,ElementType element)
{
    if((qp->len+1)%MAX==qp->front)
    {
        printf("the queue is full\n");
        return;
    }
    
    qp->queue[qp->rear]=element;
    qp->rear++;
    qp->rear=qp->rear%MAX;
    qp->len++;
}
ElementType *Pop(Queue *qp)
{
    if(qp->front==qp->rear)
    {
        printf("the queue is empty\n");
        return NULL;
    }
    qp->FrontData=qp->queue[qp->front];
    qp->front++;
    qp->front=qp->front%MAX;
    qp->len--;
    return &qp->FrontData;
}
void main()
{
    Queue qp;
    InitQueue(&qp);
    for(int i=0;i<10;i++)
    {
        Push(&qp,i+1);
    }
    // for(int i=0;i<9;i++)
    // {
    //     printf("%d ",*Pop(&qp));
    // }
    printf("\n");
    
}
//////